#!/bin/sh


echo -e "\nEnter username:\n"

read user

echo -e "\nEnter password for $user:\n"

read uspw

echo -e "\nEnter password for root:\n"

read rtpw

echo -e "\nEnter hostname (device name):\n"

read host



echo "$user $uspw $rtpw $host" > ./confidentials

#sgdisk --zap-all /dev/sda

wipefs --all /dev/sda

sgdisk --zap-all /dev/sda

sgdisk -n 0:0:+1MiB -t 0:ef02 -c 0:grub /dev/sda

sgdisk -n 0:0:+300MiB -t 0:ea00 -c 0:boot /dev/sda

sgdisk -n 0:0:+4GiB -t 0:8200 -c 0:swap /dev/sda

sgdisk -n 0:0:0 -t 0:8300 -c 0:root /dev/sda


mkswap /dev/sda3
swapon /dev/sda3


mkfs.ext4 /dev/sda4


timedatectl set-ntp true


sed -i "s/^#ParallelDownloads = 5$/ParallelDownloads = 15/" /etc/pacman.conf



pacman-key --init

pacman-key --populate archlinux


mount /dev/sda4 /mnt

pacstrap /mnt base base-devel linux linux-firmware



genfstab -U /mnt >> /mnt/etc/fstab


mkdir /mnt/root

cp confidentials /mnt/confidentials

cp pkgs /mnt/pkgs

cp config.sh /mnt/config.sh

mkdir /mnt/home/$user

cp user.sh /mnt/home/$user/user.sh

chmod +x /mnt/config.sh

arch-chroot /mnt ./config.sh


rm /mnt/{confidentials,pkgs,config.sh}

rm /mnt/home/$user/user.sh

umount -R /mnt

echo -e "\nInstallation Complete"


